#ifndef GODOT_ARRAY_HPP
#define GODOT_ARRAY_HPP

#include "Variant.hpp"
namespace Godot
{

class Array:public godot_array
{

public:
    constexpr static auto VariantAs=&godot_gdnative_core_api_struct::godot_variant_as_array;

    Array()
    {
        Godot::GODOT_CORE_API->godot_array_new(this);
    }

    Array(const Array &p_v)
    {
        Godot::GODOT_CORE_API->godot_array_new_copy(this,&p_v);
    }
    Array& operator=(const Array& p_v)
    {
        GODOT_CORE_API->godot_array_destroy(this);//先将原本指向的数据清除
        GODOT_CORE_API->godot_array_new_copy(this,&p_v);//拷贝数据
        return *this;
    }
    Array(Array&& p_v)
    {

        // printf("IN String(String&& p_v): \n");
        // printf("%d\n",*(int*)&p_v);

        *(POINTER_T*)_dont_touch_that=*(POINTER_T*)(p_v._dont_touch_that);

    }
    Array& operator=(Array&& p_v)
    {

        GODOT_CORE_API->godot_array_destroy(this);//先将原本指向的数据清除

        *(POINTER_T*)_dont_touch_that=*(POINTER_T*)(p_v._dont_touch_that);

        return *this;
    }
    ~Array()
    {
        printf(" ~Array yes; \n");
        Godot::GODOT_CORE_API->godot_array_destroy(this);
    }

    Variant& operator [](int i)
    {
        return *(Variant*)Godot::GODOT_CORE_API->godot_array_operator_index(this,i);
    }

    inline void destroy();

    inline Variant toVariant();



    inline int64_t size()
    {
        return Godot::GODOT_CORE_API->godot_array_size(this);
    }
    inline void resize(int64_t i)
    {
        return Godot::GODOT_CORE_API->godot_array_resize(this,i);
    }



};

}

#endif // GODOT_ARRAY_HPP
